<template>
	<view>
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				order:this.$route.params.order
			}
		},
		mounted(){
			this.getData()
		},
		methods:{
			getData(){
				console.log(this.order);
				let json = this.$qs.stringify({
					outTradeNo:this.order.ordersNumber,
					subject:this.order.uid + "的订单",
					totalAmount:this.order.sumPrice.toFixed(2),
					body:''
				});
				console.log(json);
				this.$request("post","/pay",json).then(res =>{
					const divForm = document.getElementsByTagName('div')
					if(divForm.length){
						document.body.removeChild(divForm[0])
					}
					const div = document.createElement('div')
					div.innerHTML = res.data
					document.body.appendChild(div)
					document.forms[0].setAttribute('target','_self')
					document.forms[0].submit()
				})
			}
		}
	}
</script>

<style>
</style>